Event Object Attributes

When a rule is triggered, the function is provided the event instance that triggered it. The specific data depends on the event type. For example, the event object returned by the ItemStateChangedEvent event type has itemName, itemState, and oldItemState attributes. The StartupTrigger and GenericCronTrigger do not provide any event objects. Rather than digging through the code to look up the attributes available in a particular event object, you can add a log entry inside the function and then trigger the rule (View the names of an object’s attributes).

Here is a table of the attributes available in event objects (or inputs['event'], if using raw API or extensions), including a comparison to the Rules DSL implicit variables:

Rules DSL Equivalent

Scripted Automation

@when Trigger(s)

Event Object(s)

Description

triggeringItem.name

event.itemName

“received update”
“changed”
“received command”
Name of Item that triggered event (String)

triggeringItem.name

event.memberName

“changed”
Name of member that caused the state
change of a parent Group (String)

triggeringItem.state

event.itemState

“received update”
“changed”
State of item that triggered event (State)

previousState

event.oldItemState

“changed”
Previous state of Item or Group that
triggered event (State)

receivedCommand

event.itemCommand

“received command”
Command that triggered event (Command)
N/A

event.predictedState

Not currently supported
State that the Item triggering the event
is predicted to have (State)
N/A

event.isConfirmation

Not currently supported
If true then it basically only confirms
the previous item state because a received
command will not be successfully executed
and therefore presumably will not result in
a state change (e.g. because no handler
currently is capable of delivering such an
event to its device) (Boolean)
N/A

event.newItemState

Not currently supported
State of Group that triggered event (State)
N/A

event.item

Not currently supported
Item that triggered event (Item)
N/A

event.oldItem

Not currently supported
Item DTO prior to the Item being updated
(Item)
N/A

event.channel

“triggered”
Channel associated with Event that
triggered event (Channel)
N/A

event.event

“triggered”
Event that triggered event (Event)
N/A

event.thing

Not currently supported
Thing that triggered event (Thing)
N/A

event.oldThing

Not currently supported
Thing DTO prior to the Thing being updated
(Thing)
N/A

event.thingUID

“changed”
ThingUID of Thing that triggered event
(ThingUID)
N/A

event.statusInfo

“changed”
ThingStatusInfo of Thing that triggered
event (ThingStatusInfo)
N/A

event.oldStatusInfo

“changed”
Previous ThingStatusInfo of Thing that
triggered event (ThingStatusInfo)